<template>
  <el-button v-if="isShow"><slot></slot></el-button>
</template>

<script lang="ts">
import { defineComponent } from "vue";

export default defineComponent({
  name: "MyButton",
});
</script>

<script lang="ts" setup>
import { computed } from "vue";
import { useUserStore } from "@/stores/user";
import { storeToRefs } from "pinia";
import pinia from "@/stores";

// 导入用户信息
const { userInfo } = storeToRefs(useUserStore(pinia));

const props = defineProps<{
  premission: string;
}>();

const isShow = computed(() => {
  return userInfo.value.buttons.includes(props.premission);
});
</script>
